<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <title>LeanTube: {{ qq }}</title>
  <SCRIPT LANGUAGE="javascript">
    function i(){document.t.submit()}
    function setbg(color){document.getElementById("styled").style.background=color}
  </SCRIPT>
  <link href="/css/lean.css" media="screen" rel="stylesheet" type="text/css"/>
  <script src="/css/proto.js" type="text/javascript"></script>
</head>
<body>
<div id="header">

<div id="search">
    <form action="/t9" method="get">
      <input autocomplete="off" id="search_box" name="q" type="text" value="{{ qq }}" onUnfocus="i()"/>
      <input id="search_button" name="commit" type="submit" value="Search"/>
      <div id="options">
        <INPUT TYPE="checkbox" id="racy" name=racy {% if racy %}checked{% endif %}>racy content
        <INPUT TYPE="checkbox" id="sfw" name=sfw {% if sfw %}checked{% endif %}>safe content
      </div>
    </form>
</div>
{% if entry %}
    <i>Your Search for {{ qq }} yields {{ entry|length }} results:</i>
{% else %}
    The query took to long without returning results, you might want to try again.
{% endif %}
</div>
<div id="search_result">
<table>
  {% for e in entry %}
  <tr>
    {% if e.title %}
    <td><div id="search_result_name">{{ e.title.Pt }}</div></td>

    <td> {% for i in e.mediaPgroup.mediaPthumbnail %}
      {% if forloop.first %}

      {% for player in e.mediaPgroup.mediaPplayer %}
      <a href="{{  player.url }}">
        <img src="{{ i.url }}" height="{{ i.height }}" width="{{ i.width }}">
      </a>
      {% endfor %}
      {% endif %}
      {% endfor %}
    </td>
    <td>
      Viewed {{ e.ytPstatistics.viewCount }} Favoured {{ e.ytPstatistics.favoriteCount }} times.
      <br>
      length: {{ e.mediaPgroup.ytPduration.seconds }} secs.
    </td>
    {% endif %}
  </tr>
  {% endfor %}
</table>
</div>
</body>
</html>
